﻿FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 5000

FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY src/Hicap.AuthorizationServer.Web/Hicap.AuthorizationServer.Web.csproj src/Hicap.AuthorizationServer.Web/
COPY src/Hicap.AuthorizationServer.EntityFrameworkCore/Hicap.AuthorizationServer.EntityFrameworkCore.csproj src/Hicap.AuthorizationServer.EntityFrameworkCore/
COPY src/Hicap.AuthorizationServer.Core/Hicap.AuthorizationServer.Core.csproj src/Hicap.AuthorizationServer.Core/
COPY src/Hicap.AuthorizationServer.Application/Hicap.AuthorizationServer.Application.csproj src/Hicap.AuthorizationServer.Application/
#RUN dotnet restore src/Hicap.AuthorizationServer.Web/Hicap.AuthorizationServer.Web.csproj
COPY . .
WORKDIR /src/src/Hicap.AuthorizationServer.Web
RUN dotnet build Hicap.AuthorizationServer.Web.csproj -c Release -o /app

FROM build AS publish
RUN dotnet publish Hicap.AuthorizationServer.Web.csproj -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Hicap.AuthorizationServer.Web.dll"]
